package com.zyd.module.admin.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;


import com.zyd.module.admin.model.ProductImage;
import com.zyd.module.admin.service.ProductImageService;



/**
 * 
 *
 * @author hui
 * @email *****@mail.com
 * @date 2022-04-04 00:17:38
 */
@Controller
@RequestMapping("/")
public class ProductImageController {
    @Autowired
    private ProductImageService productImageService;


    /**
    * 跳转到页面
    */
    @GetMapping("/index/productImage")
    public String productImage() {
        return "productimage/list";
        }

    @ApiOperation(value = "新增")
    @PostMapping("productImage/add")
    @RequiresPermissions("productImage:add")
    @ResponseBody
    public String add(@RequestBody ProductImage productImage){
        productImageService.save(productImage);
        return null;
    }

    @ApiOperation(value = "删除")
    @DeleteMapping("productImage/delete")
    @RequiresPermissions("productImage:delete")
    @ResponseBody
    public String delete(@RequestBody @ApiParam(value = "id集合") List<String> ids){
        productImageService.removeByIds(ids);
        return null;
    }

    @ApiOperation(value = "更新")
    @PutMapping("productImage/update")
    @RequiresPermissions("productImage:update")
    @ResponseBody
    public String update(@RequestBody ProductImage productImage){
        productImageService.updateById(productImage);
        return null;
    }



}
